<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex align-stretch benben-position-layout flex recommendCommodityList_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex align-center justify-between recommendCommodityList_fd0_0'>
					<view class='flex align-center' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
						<text class='fu-iconfont2  recommendCommodityList_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view style="font-size: 36rpx;font-weight: 500;">选择教练</view>
					<view class="recommendCommodityList_fd0_0_c0_c0"></view>
				</view>
			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<view class="loading_css" v-if="isShow">
				<u-loading size="36" color="#F35D2A"></u-loading>
				<view>加载中</view>
			</view>
			<block v-else>
				<view class="coach_list">
					<view class="coach_item" v-for="(item, index) in list" :key="index" @tap.stop="selectCoach(index)">
						<view class="select_icon">
							<image v-if="item.isSelect" :src='STATIC_URL+"819.png"' mode=""></image>
							<image v-else :src='STATIC_URL+"135.png"' mode=""></image>
						</view>
						<view class="coach_view">
							<view class="course_item_left">
								<image :src='item.image' mode="aspectFill"></image>
							</view>
							<view class="course_item_right">
								<view class="course_item_right_1">
									<view class="coach_name">{{item.name}}</view>
									<u-rate :disabled="true" :count="5" v-model="item.stars" active-color="#FC5830" inactive-color="#C1C1C1" gutter="0" size="20" inactive-icon="star-fill"></u-rate>
								</view>
								<view class="course_item_right_2" v-if="item.label.length > 0">
									<view class="course_item_right_2_1" v-for="(v, k) in item.label" :key="k">
										{{v}}
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="yuyue_btn" @tap.stop="confirmCoach">
					<text>确认</text>
				</view>
			</block>

			<view class="noData" v-if="list.length == 0 && !isShow">
				<image :src='STATIC_URL+"no.png"'></image>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {
			
		},

		data() {
			return {
				"count": 5,
				"value": 4,
				"list": [],
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"iconType": 'flower',
				"loadText": {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				"isShow": true,
				
				"selectIndex": -1,
				"aid": "",
				"coachInfo": {
					id: "",
					name: ""
				}
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {
				aid,
			} = options
			if (aid !== undefined) this.aid = aid;
			this.getList();
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = true;
			this.getList();
		},
		// 上拉加载
		onReachBottom() {
			if (this.page >= this.last_page) return;
			this.status = 'loading';
			this.page++;
			setTimeout(() => {

				if (this.page >= this.last_page) this.status = 'nomore';
				else this.status = 'loading';
				this.is_pull = false;
				this.getList();
			}, 500)
		},
		onPageScroll(e) {

		},
		methods: {
			getList() {
				this.$api.post(global.API_VERSION + '65b74b9dd1a83', {
					page: this.page,
					course_id: this.aid
				}).then(res => {
					// console.log(res);
					this.isShow = false;
					if (res.data.code == 1) {
						this.list = res.data.data;
						if (this.list.length > 0) {
							this.list.forEach((v, k) => {
								v.isSelect = false;
							})
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			selectCoach(index) {
				this.list.forEach((v, k) => {
					v.isSelect = false;
				})
				this.list[index].isSelect = true;
				this.selectIndex = index;
				this.coachInfo.id = this.list[index].aid;
				this.coachInfo.name = this.list[index].name;
				this.$forceUpdate();
			},
			confirmCoach() {
				if (!this.coachInfo.id) {
					this.$message.info('请选择教练');
					return;
				}
				uni.$emit('select', this.coachInfo);
				uni.$emit('selectCoachInfo', this.list[this.selectIndex]);
				uni.navigateBack();
			}
		}
	};
</script>
<style lang="scss" scoped>
	.coach_list {
		padding: 0 24rpx;
		.coach_item {
			width: 100%;
			display: flex;
			align-items: center;
			.select_icon {
				width: 36rpx;
				height: 36rpx;
				margin-right: 24rpx;
				image {
					width: 36rpx;
					height: 36rpx;
				}
			}
			.coach_view {
				width: calc(100% - 60rpx);
				border-radius: 16rpx;
				padding: 24rpx;
				margin-top: 20rpx;
				display: flex;
				background: #FFFFFF;
				.course_item_left {
					width: 88rpx;
					height: 88rpx;
					
					image {
						width: 100%;
						height: 100%;
						border-radius: 50%;
					}
				}
					
				.course_item_right {
					width: calc(100% - 108rpx);
					margin-left: 20rpx;
					
					.course_item_right_1 {
						display: flex;
						align-items: center;
						justify-content: space-between;
						
						.coach_name {
							font-size: 30rpx;
							text-overflow: ellipsis;
							overflow: hidden;
							display: -webkit-box;
							-webkit-box-orient: vertical;
							-webkit-line-clamp: 1; /* 这里是超出几行省略 */
						}
					}
					.evaluate {
						margin-top: 4rpx;
					}
					.course_item_right_2 {
						margin-top: 16rpx;
						overflow: hidden;
						.course_item_right_2_1 {
							color: #FD9E30;
							font-size: 20rpx;
							background: rgba(255,255,255,0.2);
							padding: 2rpx 16rpx;
							border: 1px solid #FD9E30;
							border-radius: 35rpx;
							float: left;
							margin-right: 16rpx;
							margin-bottom: 8rpx;
						}
					}
				}
			}
		}
	}
	.yuyue_btn {
		width: 100%;
		height: 88rpx;
		background: #F35D2A;
		position: fixed;
		left: 0;
		bottom: 0;
		line-height: 88rpx;
		text-align: center;
		font-size: 28rpx;
		color: #fff;
	}
	.index_fd1_0 {
		width: 750rpx;
		height: 750rpx;
		position: relative;
		.play_btn {
			width: 64rpx;
			height: 64rpx;
			position: absolute;
			left: 50%;
			top: 50%;
			transform: translate(-50%,-50%);
		}
	}
	.swiper_num {
		width: 70rpx;
		height: 41rpx;
		background: rgba(0, 0, 0, 0.16);
		border-radius: 21rpx;
		position: absolute;
		right: 24rpx;
		bottom: 26rpx;
		z-index: 10;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #fff;
		.swiper_num_1 {
			font-size: 32rpx;
		}
		.swiper_num_2 {
			font-size: 24rpx;
		}
	}
	.searchye_fd0_0_c1_c1 {
		margin: 0rpx 0rpx 0rpx 16rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: #333;
		flex: 1;
		height: 100%;
		padding: 0 48rpx 0 0;
	}
	
	.searchye_fd0_0_c1_c0 {
		width: 32rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}
	
	.searchye_fd0_0_c1 {
		background: #F9F9F9;
		background-size: 100% auto !important;
		border-radius: 36rpx 36rpx 36rpx 36rpx;
		width: 686rpx;
		height: 64rpx;
		margin: 0 32rpx;
		padding: 0 24rpx;
		position: relative;
	}
	.close_btn {
		width: 40rpx;
		height: 40rpx;
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
		right: 16rpx;
	}
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background-size: 100% auto;
		background-color: #f8f8f8;
	}

	.recommendCommodityList_flex_0 {
		width: 750rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto;
		background: #FFFFFF;
	}

	.recommendCommodityList_fd0_0_c1_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: var(--benbenFontColor0);
		margin: 0rpx 0rpx 0rpx 16rpx;
		width: 336rpx;
	}

	.recommendCommodityList_fd0_0_c1_c0 {
		width: 32rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.recommendCommodityList_fd0_0_c1 {
		background: #F9F9F9;
		height: 64rpx;
		width: 436rpx;
		border-radius: 34rpx 34rpx 34rpx 34rpx;
		padding: 0rpx 24rpx 0rpx 24rpx;
		margin: 0rpx 0rpx 0rpx 32rpx;
	}

	.recommendCommodityList_fd0_0_c0_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
		width: 50rpx;
	}

	.recommendCommodityList_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
		width: 100%;
	}

	.recommendCommodityList_flex_1 {
		background: #FFFFFF;
	}

	.recommendCommodityList_titlefd1_0_c0_c4 {
		margin: 0rpx 68rpx 0rpx 68rpx;
	}
	.recommendCommodityList_titlefd1_0_c0_c5 {
		margin: 0rpx 68rpx 0rpx 68rpx;
	}

	.recommendCommodityList_titleItemfd1_0_c0_c3_c0 {
		// font-size: 28rpx;
		font-weight: 400;
	}

	.recommendCommodityList_titlefd1_0_c0_c3 {
		margin: 0rpx 64rpx 0rpx 64rpx;
		// font-size: 32rpx;
		font-weight: 500;
	}

	.recommendCommodityList_linefd1_0_c0 {
		background: #F35D2A;
		width: 40rpx;
		height: 5rpx;
		top: 84rpx;
		background-size: 100% auto !important;
		border-radius: 3rpx 3rpx 0rpx 0rpx;
	}

	.checkTitlefd1_0_c0 {
		font-weight: 500 !important;
		font-size: 32rpx !important;
		color: #333 !important;
	}

	::v-deep .recommendCommodityList_benbenTabsfd1_0_c0 {
		background: #fff;
		// width: 750rpx;
		height: 90rpx;
		white-space: nowrap;
		text-align: center;
	}

	.recommendCommodityList_fd1_0 {
		// padding: 0rpx 32rpx 0rpx 32rpx;
		justify-content: center;
	}

	.recommendCommodityList_flex_2 {
		background-size: 100% auto;
		padding: 0rpx 24rpx 0rpx 24rpx;
	}

	.recommendCommodityList_fd2_0 {
		background: var(--benbenbgColor1);
	}

	.recommendCommodityList_flex_3 {
		background-size: 100% auto;
		padding: 0rpx 24rpx 0rpx 24rpx;
	}

	.recommendCommodityList_fd3_0_c0_c2_c0 {
		width: 44rpx;
		height: 44rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.recommendCommodityList_fd3_0_c0_c2 {
		position: absolute;
		right: 20rpx;
		top: 20rpx;
	}

	.recommendCommodityList_fd3_0_c0_c1_c1_c3 {
		color: #666666;
		font-size: 24rpx;
		font-weight: 400;
		max-width: 45rpx;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}

	.recommendCommodityList_fd3_0_c0_c1_c1_c2 {
		width: 32rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 13rpx 0rpx auto;
	}

	.recommendCommodityList_fd3_0_c0_c1_c1_c1 {
		color: #666666;
		font-size: 24rpx;
		font-weight: 400;
		margin: 0rpx 0rpx 0rpx 12rpx;
	}

	.recommendCommodityList_fd3_0_c0_c1_c1_c0 {
		width: 40rpx;
		height: 40rpx;
		border-radius: 20rpx;
	}

	.recommendCommodityList_fd3_0_c0_c1_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		padding: 19rpx 0rpx 24rpx 0rpx;
	}

	.recommendCommodityList_fd3_0_c0_c1 {
		padding: 0rpx 25rpx 0rpx 20rpx;
	}

	.recommendCommodityList_fd3_0_c0_c0 {
		width: 335rpx;
		height: 450rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.recommendCommodityList_fd3_0_c0 {
		background: rgba(247, 246, 244, 1);
		padding: 0rpx 0rpx 24rpx 0rpx;
		background-size: 100% auto;
		position: relative;
	}

	.recommendCommodityList_flex_4 {
		background: var(--benbenbgColor1);
		padding: 0rpx 30rpx 0rpx 30rpx;
		background-size: 100% auto !important;
	}

	.recommendCommodityList_fd4_0_c2_1 {
		border: 1px solid #AD3823;
		background: rgba(173, 56, 35, 1);
		border-radius: 32rpx 32rpx 32rpx 32rpx;
		width: 172rpx;
		line-height: 64rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor3);
		height: 64rpx;
	}

	.recommendCommodityList_fd4_0_c2 {
		border: 1px solid #AD3823;
		background: var(--benbenbgColor1);
		border-radius: 32rpx 32rpx 32rpx 32rpx;
		width: 172rpx;
		line-height: 64rpx;
		font-size: 32rpx;
		color: rgba(173, 56, 35, 1);
		height: 64rpx;
	}

	.recommendCommodityList_fd4_0_c1_c1_c1 {
		background: var(--benbenbgColor6);
		width: 1rpx;
		height: 30rpx;
		margin: 0rpx 10rpx 0rpx 10rpx;
		transform: scaleX(0.5);
	}

	.recommendCommodityList_fd4_0_c1_c1_c0_c1 {
		margin: 0rpx 0rpx 0rpx 10rpx;
	}

	.recommendCommodityList_fd4_0_c1_c1 {
		color: #999999;
		font-size: 24rpx;
		line-height: 33rpx;
		font-weight: 400;
	}

	.recommendCommodityList_fd4_0_c1_c0 {
		color: #000000;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 40rpx;
		margin: 0rpx 0rpx 16rpx 0rpx;
	}

	.recommendCommodityList_fd4_0_c0 {
		width: 108rpx;
		height: 108rpx;
		border-radius: 54rpx;
		margin: 0rpx 23rpx 0rpx 0rpx;
	}

	.recommendCommodityList_fd4_0 {
		border-bottom: 1px solid #eee;
		padding: 32rpx 0rpx 32rpx 0rpx;
	}


	.littleTheatre_fd2_0_c1_c2_c0_c0 {
		color: #AD3823;
		font-size: 28rpx;
		font-weight: 400;
	}

	.littleTheatre_fd2_0_c1_c2_c0 {
		background: #FFFFFF;
		width: 144rpx;
		height: 52rpx;
		// transform: translateY(-12rpx);
		position: absolute;
		bottom: 0;
		right: 0;
		border-radius: 24rpx 16rpx 0 0;
	}

	.littleTheatre_fd2_0_c1_c1_c1 {
		color: #333333;
		font-size: 34rpx;
		font-weight: 400;
		margin: 15rpx 0rpx 4rpx 0rpx;
	}

	.littleTheatre_fd2_0_c1_c1_c0 {
		color: #333333;
		font-size: 48rpx;
		font-weight: 400;
	}

	.littleTheatre_fd2_0_c1_c1 {
		margin: 56rpx 0rpx 0rpx 0rpx;
	}

	.littleTheatre_fd2_0_c1_c0 {
		width: 56rpx;
		height: 56rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		position: absolute;
		left: 24rpx;
		top: 24rpx;
	}

	.littleTheatre_fd2_0_c1 {
		// background: url(https://www.guochaoxiaoju.com/uploads/mini/514.png) no-repeat;
		background-size: 100% 220rpx;
		background-repeat: no-repeat;
		position: relative;
		margin: 0rpx 0rpx 24rpx 0rpx;
		height: 220rpx;
	}





	.otherFollow_fd1_1_c2_2 {
		border: 1px solid #62889B;
		background: #F8F8F8;
		border-radius: 32rpx 32rpx 32rpx 32rpx;
		width: 172rpx;
		line-height: 64rpx;
		font-size: 32rpx;
		color: rgba(98, 136, 155, 1);
		height: 64rpx;
	}

	.otherFollow_fd1_1_c2_1 {
		border: 1px solid #AD3823;
		background: var(--benbenbgColor2);
		border-radius: 32rpx 32rpx 32rpx 32rpx;
		width: 172rpx;
		line-height: 64rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor3);
		height: 64rpx;
	}

	.otherFollow_fd1_1_c2 {
		border: 1px solid #AD3823;
		background: #F8F8F8;
		border-radius: 32rpx 32rpx 32rpx 32rpx;
		width: 172rpx;
		line-height: 64rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor4);
		height: 64rpx;
	}

	.otherFollow_fd1_1_c1_c1_c1 {
		background: var(--benbenbgColor6);
		width: 1rpx;
		height: 30rpx;
		margin: 0rpx 10rpx 0rpx 10rpx;
		transform: scaleX(0.5);
	}

	.otherFollow_fd1_1_c1_c1_c0_c1 {
		margin: 0rpx 0rpx 0rpx 10rpx;
	}

	.otherFollow_fd1_1_c1_c1 {
		color: #999999;
		font-size: 24rpx;
		line-height: 33rpx;
		font-weight: 400;
	}

	.otherFollow_fd1_1_c1_c0 {
		color: #000000;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 40rpx;
		margin: 0rpx 0rpx 16rpx 0rpx;
	}

	.otherFollow_fd1_1_c0 {
		width: 108rpx;
		height: 108rpx;
		border-radius: 54rpx;
		margin: 0rpx 23rpx 0rpx 0rpx;
	}

	.otherFollow_fd1_1 {
		border-bottom: 1px solid #eee;
		padding: 32rpx 0rpx 32rpx 0rpx;
	}
</style>